<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"></xsl:output>
<xsl:variable name="crlf">;
</xsl:variable>
<xsl:variable name="headerNavigationId">1</xsl:variable>
<xsl:variable name="headerNavigationNumber">1</xsl:variable>
<xsl:variable name="headerNavigationParentId">0</xsl:variable>
<xsl:template match="/*">
<xsl:call-template name="navigationTitle">
<xsl:with-param name="id" select="$headerNavigationId"/>
<xsl:with-param name="number" select="$headerNavigationNumber"/>
<xsl:with-param name="parentId" select="$headerNavigationParentId"/>
<xsl:with-param name="title">Бухгалтерская справка (ф.0504833)</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">Номер документа</xsl:with-param>
<xsl:with-param name="text" select="NUM_DOC"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">Код ТОФК</xsl:with-param>
<xsl:with-param name="text" select="TOFK_CODE"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">Дата документа</xsl:with-param>
<xsl:with-param name="text" select="DATE_DOC"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">Бюджет</xsl:with-param>
<xsl:with-param name="text" select="BUDGET"/>
</xsl:call-template>
<xsl:text>&#xa;</xsl:text>
<xsl:variable name="T0504833_Table_NavigationId" select="$headerNavigationId + 1"/>
<xsl:call-template name="T0504833_Table_Template">
<xsl:with-param name="tableId" select="$T0504833_Table_NavigationId"/>
<xsl:with-param name="number" select="1"/>
<xsl:with-param name="parentId" select="$headerNavigationId"/>
</xsl:call-template>	
</xsl:template>
<xsl:template name="T0504833_Table_Template">
<xsl:param name="tableId"/>
<xsl:param name="number"/>
<xsl:param name="parentId"/>
<xsl:if test="T0504833">
<xsl:call-template name="navigationTitle">
<xsl:with-param name="number" select="$number"/>
<xsl:with-param name="parentId" select="$parentId"/>
<xsl:with-param name="title">Т0504833</xsl:with-param>
<xsl:with-param name="id" select="$tableId"/>
</xsl:call-template>
<xsl:for-each select="T0504833/T0504833_ITEM">
<xsl:call-template name="T0504833_Line_Template">
<xsl:with-param name="tableId" select="$tableId"/>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="T0504833_Line_Template">
<xsl:param name="tableId"/>
<xsl:variable name="lineId" select="$tableId+position()"/>
<xsl:call-template name="navigationTitle">
<xsl:with-param name="id" select="$lineId"/>
<xsl:with-param name="number" select="position()"/>
<xsl:with-param name="parentId" select="$tableId"/> 
<xsl:with-param name="title">Строка <xsl:value-of select="position()"/></xsl:with-param>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">Номер</xsl:with-param>
<xsl:with-param name="text" select="NPP"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">основание операции</xsl:with-param>
<xsl:with-param name="text" select="NAME_OO"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">Номер документа</xsl:with-param>
<xsl:with-param name="text" select="NDOC"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">Дата документа</xsl:with-param>
<xsl:with-param name="text" select="DATEDOC"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">по дебету</xsl:with-param>
<xsl:with-param name="text" select="DTACC"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">по кредиту</xsl:with-param>
<xsl:with-param name="text" select="CTACC"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">Сумма</xsl:with-param>
<xsl:with-param name="text" select="SUMM"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">КБК</xsl:with-param>
<xsl:with-param name="text" select="DT_KBK"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">ВД</xsl:with-param>
<xsl:with-param name="text" select="DT_KVFO"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">ПЛС</xsl:with-param>
<xsl:with-param name="text" select="DT_PLS"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">ЛС</xsl:with-param>
<xsl:with-param name="text" select="DT_LS"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">КС</xsl:with-param>
<xsl:with-param name="text" select="DT_KS"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">БО</xsl:with-param>
<xsl:with-param name="text" select="DT_BO"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">ФАИП</xsl:with-param>
<xsl:with-param name="text" select="DT_FAIP"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">ОКТМО</xsl:with-param>
<xsl:with-param name="text" select="DT_OKTMO"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">Подведомственное учреждение</xsl:with-param>
<xsl:with-param name="text" select="DT_PUCH"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">Признак заключительных оборотов</xsl:with-param>
<xsl:with-param name="text" select="DT_PZO"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">ФО</xsl:with-param>
<xsl:with-param name="text" select="DT_FO"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">КБК</xsl:with-param>
<xsl:with-param name="text" select="CT_KBK"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">ВД</xsl:with-param>
<xsl:with-param name="text" select="CT_KVFO"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">ПЛС</xsl:with-param>
<xsl:with-param name="text" select="CT_PLS"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">ЛС</xsl:with-param>
<xsl:with-param name="text" select="CT_LS"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">КС</xsl:with-param>
<xsl:with-param name="text" select="CT_KS"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">БО</xsl:with-param>
<xsl:with-param name="text" select="CT_BO"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">ФАИП</xsl:with-param>
<xsl:with-param name="text" select="CT_FAIP"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">ОКТМО</xsl:with-param>
<xsl:with-param name="text" select="CT_OKTMO"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">Подведомственное учреждение</xsl:with-param>
<xsl:with-param name="text" select="CT_PUCH"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">Признак заключительных оборотов</xsl:with-param>
<xsl:with-param name="text" select="CT_PZO"/>
</xsl:call-template>
<xsl:call-template name="simpleLine">
<xsl:with-param name="header">ФО</xsl:with-param>
<xsl:with-param name="text" select="CT_FO"/>
</xsl:call-template>
<xsl:text>&#xa;</xsl:text>
</xsl:template>
<xsl:template name="navigationTitle">
<xsl:param name="number"/>
<xsl:param name="parentId"/>
<xsl:param name="title"/>
<xsl:param name="id"/>[Title id='<xsl:value-of select="$id"/>' number='<xsl:value-of select="$number"/>' parentId='<xsl:value-of select="$parentId"/>' name='<xsl:value-of select="$title"/>']
</xsl:template>
<xsl:template name="simpleLine">
<xsl:param name="header"/>
<xsl:param name="text"/>
<xsl:value-of select="normalize-space($header)" disable-output-escaping="yes"/>
<xsl:text>=</xsl:text>
<xsl:value-of select="normalize-space($text)" disable-output-escaping="yes"/>
<xsl:value-of select="$crlf" disable-output-escaping="yes"/>
</xsl:template>
</xsl:stylesheet>
